using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class ViewParamMap : EntityTypeConfiguration<ViewParam>
    {
        public ViewParamMap()
        {
            // Primary Key
            this.HasKey(t => t.BillNumber);

            // Properties
            this.Property(t => t.BillNumber)
                .IsRequired()
                .IsFixedLength()
                .HasMaxLength(8);

            this.Property(t => t.Guar1)
                .IsFixedLength()
                .HasMaxLength(6);

            this.Property(t => t.Guar2)
                .IsFixedLength()
                .HasMaxLength(6);

            this.Property(t => t.Patient)
                .IsFixedLength()
                .HasMaxLength(6);

            this.Property(t => t.batch)
                .IsFixedLength()
                .HasMaxLength(8);

            // Table & Column Mappings
            this.ToTable("ViewParam");
            this.Property(t => t.BillNumber).HasColumnName("BillNumber");
            this.Property(t => t.Guar1).HasColumnName("Guar1");
            this.Property(t => t.Guar2).HasColumnName("Guar2");
            this.Property(t => t.Patient).HasColumnName("Patient");
            this.Property(t => t.batch).HasColumnName("batch");
        }
    }
}
